{% extends "html/notebook/base.html" %}
{#
INPUT:
- worksheet - an instance of Worksheet
- notebook - an instance of Notebook which contains worksheet
- do_print - a boolean stating whether the file is for print mode
#}

{% block page_id %}user-worksheet-page{% endblock %}
{% block body_classes %}active-worksheet{% endblock %}
 
{% block worksheet_main %}
{% set toggle=true %}
<div class="worksheet" id="worksheet">
    {{ worksheet.html(username=username) }}
    <div class="insert_new_cell" id="insert_last_cell"></div>  
    <script type="text/javascript">
        state_number = {{ worksheet.state_number() }};
        cell_id_list = {{ worksheet.cell_id_list() }};
        queue_id_list = {{ worksheet.queue_id_list() }};
        {% if worksheet.is_only_viewer(username) %}
        worksheet_locked = true;
        {% else %}
        worksheet_locked = false;
	    {% endif %}

        $(document).ready(function () {
            if (worksheet_name === "{{ gettext('Untitled') }}") {
                rename_worksheet();
            }
         });

        $("#insert_last_cell").bind("plainclick", function (e) {
            insert_new_cell_after(cell_id_list[cell_id_list.length - 1]);
        });
    
        {% if not worksheet.docbrowser() %}
        $("#insert_last_cell").bind("shiftclick", function (e) {
            insert_new_text_cell_after(cell_id_list[cell_id_list.length - 1]);
        });
        {% endif %}
    </script>
</div>
{% endblock %}
